package com.ltf.common.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Auther: liutf
 * @Date: 2025/3/24
 * @Description: com.ltf.product.dto
 * @version: 1.0
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class ResponseDTO<T> {
    private Integer code;
    private String message;
    private T data;

    //成功
    public static <E> ResponseDTO<E> success(E data){
        return new ResponseDTO<>(200,"ok",data);
    }

    //成功
    public static ResponseDTO success(){
        return new ResponseDTO<>(200,"ok",null);
    }

    //失败
    public static ResponseDTO failed(String message){
        return new ResponseDTO<>(500,message,null);
    }

}
